{include file='header'/}
<body class="pear-admin">
<form class="layui-form" action="{:url('admin/adminPass')}" method="post">
    <div class="mainBox">
        <div class="main-container">
            <div class="layui-form-item">
                <label class="layui-form-label required">旧密码</label>
                <div class="layui-input-block">
                    <input type="password" id="oldpwd" name="oldpwd" lay-verify="required" autocomplete="off"
                           placeholder="请输入旧密码" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label required">新密码</label>
                <div class="layui-input-block">
                    <input type="password" id="newpwd" name="newpwd" lay-verify="required|pwd" autocomplete="off"
                           placeholder="请输入新密码" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label required">确定密码</label>
                <div class="layui-input-block">
                    <input type="password" id="confirm" name="confirm" lay-verify="required|confirmPass"
                           autocomplete="off" placeholder="请再次输入密码" class="layui-input">
                </div>
            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <input type="hidden" name="id" value="<?php echo $id; ?>">
            <input type="hidden" name="__token__" value="{:token()}" />
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
                    lay-filter="admin-save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="pear-btn pear-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>

{include file='footer'/}
<script>
  layui.use(['form', 'jquery'], function () {
    let form = layui.form;
    let $ = layui.jquery;
    form.verify({
      pwd: ui_rule.password,
      confirmPass: function (value) {
        if ($('input[name=newpwd]').val() !== value)
          return '两次密码输入不一致！';
      }
    });
  })
</script>
